package com.practice.ajCollections010.list.linkedlist;

import java.util.LinkedList;

/**
 * 转换问题:
 *          1. 将 LinkedList 转换为 数组
 */
public class Convert {
    public static void main(String[] args) {
        LinkedList<String> linkedList = new LinkedList<>();
        linkedList.add("Hello");
        linkedList.add("Mr.");
        linkedList.add("yang");

        Object[] objects = linkedList.toArray();
        String str = (String) objects[0];
        System.out.println(str);

        String[] strings = new String[objects.length];
        String[] strings1 = linkedList.toArray(strings);
        System.out.println(strings1[1]);

    }
}
